package com.hx.petsever.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hx.petsever.entity.Goods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {
        @Select("select * from goods where number > 0")
        List<Goods> getAll();

        @Select("select * from goods where id = #{id}")
        Goods getOneById(@Param("id") Integer id);

        @Update("update goods set number = #{number}  where id = #{id}")
        void updateNumber(@Param("number") Integer number , @Param("id") Integer id);
}
